package com.hp.search_service.controller;

import com.hp.common_api.entity.PageResult;
import com.hp.search_service.entity.Goods;
import com.hp.search_service.entity.Search;
import com.hp.search_service.service.GoodsSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 商品搜索控制器
 */
@RestController
public class GoodsSearchController {

    @Autowired
    private GoodsSearchService goodsSearchService;

    @PostMapping("search")
    public ResponseEntity<PageResult<Goods>> search(@RequestBody Search search){
        return ResponseEntity.ok(goodsSearchService.search(search));
    }
}
